// ==UserScript==
// @name        人才培养中心 edu.inspur.com
// @namespace   cn.shaojs.tampermonkey.inspur.edu
// @match       https://edu.inspur.com/
// @icon        https://filecloudpro-cdn.zhixueyun.com/c6e8e5a3-fefc-46c5-8bdd-170038bf715b/image/d3ac9a0cc4434d618a3522590962019e.png
// @grant       none
// @version     1.2
// @author      xiamu
// @grant       unsafeWindow

// @description 2025/07/08 19:11:08
// ==/UserScript==


//首页
function f_home_v(){
  console.log('f_home_v start')
  if (urlpath.startsWith('/home-v')) {
    window.setTimeout(()=> {
        $("div.to-personal-center.themeColor-color.themeColor-border-color.themeColor-background-color-hover").click();
    }, 5000);
      console.log('f_home_v end')

    return false;
  }
}

//个人中心
function f_center(){
   console.log('f_center start')
  if (urlpath=='/center') {
      window.setTimeout(()=> {
          if ($("div.task-panel.themeColor-background-opacity-10-hover").find('button').size()>1){
            $("div.task-panel.themeColor-background-opacity-10-hover").find('button')[0].click();
          }

      }, 3000);
     console.log('f_center end')
      return false;
  }
}

//学习任务
function f_center_pack(){
  if (urlpath.startsWith('/center/student-study-pack-detail/')) {
      window.setTimeout(()=> {
        $("div.content > div.study-list > div > div.lists > div").find('button').click();
      }, 3000);
      return false;
  }

}

//专题
function f_subject(){
  if (urlpath.startsWith('/study/subject/detail/')) {
    window.setTimeout(()=> {
      if ($("div.subject-catalog.subject-catalog-new  div.inline-block.operation.default-skin > i > div:contains('继续学习')").size()>0){
        $("div.subject-catalog.subject-catalog-new  div.inline-block.operation.default-skin > i > div:contains('继续学习')").closest("div.operation.default-skin").find("a.normal").click();
      }else if($("div.subject-catalog.subject-catalog-new  div.inline-block.operation.default-skin > i > div:contains('开始学习')").size()>0){
        $("div.subject-catalog.subject-catalog-new  div.inline-block.operation.default-skin > i > div:contains('开始学习')").closest("div.operation.default-skin").find("a.normal").click();
      }else{
        return false;
      }

    }, 3000);
    return false;
  }
}


//课程
function f_course(){
  if (urlpath.startsWith('/study/course/detail/')) {
    window.setTimeout(()=> {
      $("div.content > div.study-list > div > div.lists > div").find('button').click();

    }, 3000);
    return false;
  }
}

//
function next_course(){

}
//
function f_errors(){
  if (urlpath.startsWith('/study/errors')) {
    window.setTimeout(()=> {
        $("#D560goOnStudy").click()
       }, 3000);
     return false;

}


var urlpath = '';
window.setInterval(()=>{
  var urlpath_new = location.href.split("#")[1];
  console.log(urlpath_new)
  if(urlpath_new!=urlpath){
    urlpath=urlpath_new

    f_home_v()
    f_center()
    f_center_pack()
    f_subject()
    f_errors()
  }else{
    console.log('noflush')

  }

},5000);

// $('.alert-wrapper').find('.btn-ok.btn').click()

// $('.chapter-list-box.required')

// var xrw=document.querySelector("#content > div.vue-app > div > div.vue-main-page > div > div:nth-child(2) > div > div > div > div > div.buttons > div.btn2.btn.themeColor-background-color")

